﻿using LiteBlog.Common.Components;
using System.ComponentModel.DataAnnotations;
namespace LiteBlog.Common.Entities
{
    public class Author
    {
        [Required(ErrorMessage = "Please enter email")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Please enter login name")]
        public string ID { get; set; }
        
        [Required(ErrorMessage = "Please enter display name")]
        public string Name { get; set; }

        public bool Locked { get; set; }
        public bool IsPrimary { get; set; }
        public bool Enabled { get; set; }

        [RegularExpression(
            @"(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?",
            ErrorMessage = "Please enter a valid web URL")]
        [UrlValid(ErrorMessage = "The URL entered is not valid. The link may be broken or the server down!")]
        public string Url { get; set; }  

        public Author()
        {
            IsPrimary = false;
            Enabled = true;
        }
    }
}